#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
typedef int btdatatype;
typedef struct binarytreenode
{
	btdatatype data;
	struct binarytreenode* left;
	struct binarytreenode* right;
}btnode;

void prevorder(btnode* root)
{
	if (root == NULL)
	{
		printf("N ");
		return;
	}
	printf("%d ", root->data);
	prevorder(root->left);
	prevorder(root->right);
}

btnode* buynode(int x)
{
	btnode* node = (btnode*)malloc(sizeof(btnode));
	if (node == NULL)
	{
		perror("malloc fail");
		return NULL;
	}
	node->data = x;
	node->left = NULL;
	node->right = NULL;
}
btnode* creattree()
{
	btnode* node1 = buynode(1);
	btnode* node2 = buynode(2);
	btnode* node3 = buynode(3);
	btnode* node4 = buynode(4);
	btnode* node5 = buynode(5);
	btnode* node6 = buynode(6);


	node1->left = node2;
	node1->right = node4;
	node2->left = node3;
	node4->left = node5;
	node4->right = node6;

	return node1;
}

int main()
{
	btnode* root = creattree();
	prevorder(root);
	printf("\n");

	return 0;
}